#include "TesPch.h"
#include "TesScanner.h"
#include "TesScannerHelper.h"
#include "TesScannerError.h"


#define LINK_PROCESSOR( state )			{ mProcessors[SS_##state] = &TesScanner::ProcessState_##state; }


TesScanner::TesScanner( const TesConfig & config )
: mConfig( config )
{
	LINK_PROCESSOR( Normal );
	LINK_PROCESSOR( InSingleQuoteString );
	LINK_PROCESSOR( InDoubleQuoteString );
	LINK_PROCESSOR( InSingleQuoteEscapeSequence );
	LINK_PROCESSOR( InDoubleQuoteEscapeSequence );
	LINK_PROCESSOR( InDecimal );
	LINK_PROCESSOR( InOctal );
	LINK_PROCESSOR( InHexadecimal );
	LINK_PROCESSOR( InDouble );
	LINK_PROCESSOR( InExponent );
	LINK_PROCESSOR( InIdentifier );
	LINK_PROCESSOR( InLineComment );

	LINK_PROCESSOR( EnterDouble );
	LINK_PROCESSOR( EnterScientific );
	LINK_PROCESSOR( EnterExponent );
	LINK_PROCESSOR( OneZeroPassed );
	LINK_PROCESSOR( OneEqualPassed );
	LINK_PROCESSOR( OneUnequalPassed );
	LINK_PROCESSOR( OneLessPassed );
	LINK_PROCESSOR( OneGreaterPassed );
	LINK_PROCESSOR( OneDotPassed );
	LINK_PROCESSOR( TwoDotPassed );
	LINK_PROCESSOR( OneEscapeDigitPassedInSingle );
	LINK_PROCESSOR( OneEscapeDigitPassedInDouble );
	LINK_PROCESSOR( TwoEscapeDigitPassedInSingle );
	LINK_PROCESSOR( TwoEscapeDigitPassedInDouble );

	mKeywordMap.insert( make_pair( t("do"), TTT_Do ) );
	mKeywordMap.insert( make_pair( t("end"), TTT_End ) );
	mKeywordMap.insert( make_pair( t("while"), TTT_While ) );
	mKeywordMap.insert( make_pair( t("if"), TTT_If ) );
	mKeywordMap.insert( make_pair( t("then"), TTT_Then ) );
	mKeywordMap.insert( make_pair( t("elseif"), TTT_Elseif ) );
	mKeywordMap.insert( make_pair( t("else"), TTT_Else ) );
	mKeywordMap.insert( make_pair( t("for"), TTT_For ) );
	mKeywordMap.insert( make_pair( t("in"), TTT_In ) );
	mKeywordMap.insert( make_pair( t("function"), TTT_Function ) );
	mKeywordMap.insert( make_pair( t("return"), TTT_Return ) );
	mKeywordMap.insert( make_pair( t("break"), TTT_Break ) );
	mKeywordMap.insert( make_pair( t("continue"), TTT_Continue ) );
	mKeywordMap.insert( make_pair( t("null"), TTT_Null ) );
	mKeywordMap.insert( make_pair( t("true"), TTT_True ) );
	mKeywordMap.insert( make_pair( t("false"), TTT_False ) );
	mKeywordMap.insert( make_pair( t("and"), TTT_And ) );
	mKeywordMap.insert( make_pair( t("or"), TTT_Or ) );
	mKeywordMap.insert( make_pair( t("not"), TTT_Not ) );
	mKeywordMap.insert( make_pair( t("class"), TTT_Class ) );
	mKeywordMap.insert( make_pair( t("method"), TTT_Method ) );
	mKeywordMap.insert( make_pair( t("struct"), TTT_Struct ) );
	mKeywordMap.insert( make_pair( t("enum"), TTT_Enum ) );
	mKeywordMap.insert( make_pair( t("new"), TTT_New ) );
}


TesScanner::~TesScanner()
{
}


void TesScanner::ScanFile( const tstring & filename )
{
	mFilename = filename;
	tifstream program( filename.c_str() );
	this->Scan( program );
}


void TesScanner::ScanString( const tstring & str )
{
	tstringstream program;
	program << str;
	this->Scan( program );
}


void TesScanner::Scan( tistream & program )
{
	ScanState curState = SS_Normal;
	mCurrentString = t("");

	mStringBeginLine = 1;
	mStringBeginColumn = 1;
	mCurrentCharLine = 1;
	mCurrentCharColumn = 1;

	while( program.good() )
	{
		tchar curChar = t('\0');
		program.read( &curChar, 1 );

		ScanProcessor processor = mProcessors[curState];
		curState = (this->*processor)( curChar );

		mCurrentCharColumn++;
		if( curChar == t('\n') )
		{
			mCurrentCharLine++;
			mCurrentCharColumn = 1;
		}
	}

	this->AddToken( TesToken( TTT_EndOfStream, this->GetCurrentCharLexLocation() ) );
}


void TesScanner::AddToken( const TesToken & token )
{
	mTokens.push_back( token );
}


void TesScanner::AppendCharToCurrentString( tchar ch )
{
	mCurrentString += ch;

	if( mCurrentString.length() == 1 )
	{
		mStringBeginLine = mCurrentCharLine;
		mStringBeginColumn = mCurrentCharColumn;
	}
}


void TesScanner::ClearCurrentString()
{
	mCurrentString.clear();
}


TesLexLocation TesScanner::GetCurrentCharLexLocation() const
{
	return TesLexLocation( mCurrentCharLine, mCurrentCharColumn, mFilename );
}


TesLexLocation TesScanner::GetStringBeginLexLocation() const
{
	return TesLexLocation( mStringBeginLine, mStringBeginColumn, mFilename );
}


void TesScanner::AddIdentifierOrKeyword()
{
	map<tstring, TesTokenType>::const_iterator it = mKeywordMap.find( mCurrentString );
	if( it == mKeywordMap.end() )
	{
		this->AddToken( TesToken( TTT_Identifier, this->GetStringBeginLexLocation(), mCurrentString ) );
	}
	else
	{
		this->AddToken( TesToken( it->second, this->GetStringBeginLexLocation(), mCurrentString ) );
	}
}


TesScanner::ScanCharType TesScanner::GetScanCharType( tchar ch )
{
	switch( ch )
	{
	case t('\r'):
	case t('\n'):
		return SCT_LineEnder;
	case t('\t'):
	case t(' '):
		return SCT_TabOrSpace;

	case t('('):
		return SCT_OpenParenthese;
	case t(')'):
		return SCT_CloseParenthese;
	case t('['):
		return SCT_OpenBracket;
	case t(']'):
		return SCT_CloseBracket;
	case t('{'):
		return SCT_OpenBrace;
	case t('}'):
		return SCT_CloseBrace;

	case t('+'):
		return SCT_Add;
	case t('-'):
		return SCT_Minus;
	case t('*'):
		return SCT_Star;
	case t('/'):
		return SCT_Slash;
	case t('\\'):
		return SCT_Backslash;
	case t('^'):
		return SCT_Power;
	case t('%'):
		return SCT_Percent;
	case t('.'):
		return SCT_Dot;
	case t('<'):
		return SCT_Less;
	case t('>'):
		return SCT_Greater;
	case t('='):
		return SCT_Equal;
	case t('!'):
		return SCT_Unequal;
	case t('#'):
		return SCT_Sharp;
	case t(':'):
		return SCT_Colon;
	case t(';'):
		return SCT_Semicolon;
	case t('\''):
		return SCT_SingleQuote;
	case t('\"'):
		return SCT_DoubleQuote;
	case t(','):
		return SCT_Comma;
	case t('\0'):
		return SCT_Null;
	}

	if( tisalpha( ch ) || ch == t('_') )
	{
		return SCT_AlphaOrUnderscore;
	}

	if( tisdigit( ch ) )
	{
		return SCT_Digit;
	}

	return SCT_Other;
}


TesScanner::ScanState TesScanner::ProcessState_Normal( tchar ch )
{
	ScanCharType type = GetScanCharType( ch );

	switch( type )
	{
	case SCT_Null:
	case SCT_TabOrSpace:
	case SCT_LineEnder:
		this->ClearCurrentString();
		return SS_Normal;
	case SCT_Semicolon:
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpSemicolon, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_AlphaOrUnderscore:
		this->ClearCurrentString();
		this->AppendCharToCurrentString( ch );
		return SS_InIdentifier;
	case SCT_Digit:
		this->ClearCurrentString();
		if( ch == t('0') )
		{
			return SS_OneZeroPassed;
		}
		else
		{
			this->AppendCharToCurrentString( ch );
			return SS_InDecimal;
		}

	case SCT_SingleQuote:
		this->ClearCurrentString();
		return SS_InSingleQuoteString;
	case SCT_DoubleQuote:
		this->ClearCurrentString();
		return SS_InDoubleQuoteString;

	case SCT_OpenParenthese:
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpenParenthese, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_CloseParenthese:
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_CloseParenthese, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_OpenBracket:
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpenBracket, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_CloseBracket:
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_CloseBracket, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_OpenBrace:
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpenBrace, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_CloseBrace:
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_CloseBrace, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;

	case SCT_Add:
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpAdd, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_Star:
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpMultiply, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_Slash:
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpDivide, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_Power:
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpPower, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_Percent:
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpMod, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_Sharp:
		this->ClearCurrentString();
		return SS_InLineComment;
	case SCT_Colon:
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpObjectMemberAccess, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_Comma:
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpComma, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;

	case SCT_Minus:
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpMinus, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_Dot:
		this->ClearCurrentString();
		this->AppendCharToCurrentString( ch );
		return SS_OneDotPassed;
	case SCT_Less:
		this->ClearCurrentString();
		this->AppendCharToCurrentString( ch );
		return SS_OneLessPassed;
	case SCT_Greater:
		this->ClearCurrentString();
		this->AppendCharToCurrentString( ch );
		return SS_OneGreaterPassed;
	case SCT_Equal:
		this->ClearCurrentString();
		this->AppendCharToCurrentString( ch );
		return SS_OneEqualPassed;
	case SCT_Unequal:
		this->ClearCurrentString();
		this->AppendCharToCurrentString( ch );
		return SS_OneUnequalPassed;

	case SCT_Backslash:
	case SCT_Other:
	default:
		TesScannerError( mConfig, t("Invalid character detected."), this->GetCurrentCharLexLocation() );
	}

	return SS_InvalidState;
}


TesScanner::ScanState TesScanner::ProcessState_InSingleQuoteString( tchar ch )
{
	ScanCharType type = GetScanCharType( ch );

	switch( type )
	{
	case SCT_Null:
		TesScannerError( mConfig, t("Unexpected end of file. Single quoted string expected."), this->GetCurrentCharLexLocation() );
	case SCT_LineEnder:
		TesScannerError( mConfig, t("Unexpected end of line. Single quoted string expected."), this->GetCurrentCharLexLocation() );

	case SCT_SingleQuote:
		this->AddToken( TesToken( TTT_String, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		return SS_Normal;

	case SCT_Backslash:
		return SS_InSingleQuoteEscapeSequence;

	case SCT_DoubleQuote:
	case SCT_TabOrSpace:
	case SCT_Semicolon:
	case SCT_AlphaOrUnderscore:
	case SCT_Digit:
	case SCT_OpenParenthese:
	case SCT_CloseParenthese:
	case SCT_OpenBracket:
	case SCT_CloseBracket:
	case SCT_OpenBrace:
	case SCT_CloseBrace:
	case SCT_Add:
	case SCT_Star:
	case SCT_Slash:
	case SCT_Power:
	case SCT_Percent:
	case SCT_Sharp:
	case SCT_Colon:
	case SCT_Comma:
	case SCT_Minus:
	case SCT_Dot:
	case SCT_Less:
	case SCT_Greater:
	case SCT_Equal:
	case SCT_Unequal:
	case SCT_Other:
		this->AppendCharToCurrentString( ch );
		return SS_InSingleQuoteString;

	default:
		TesScannerError( mConfig, t("Invalid character detected."), this->GetCurrentCharLexLocation() );
	}

	return SS_InvalidState;
}


TesScanner::ScanState TesScanner::ProcessState_InDoubleQuoteString( tchar ch )
{
	ScanCharType type = GetScanCharType( ch );

	switch( type )
	{
	case SCT_Null:
		TesScannerError( mConfig, t("Unexpected end of file. Double quoted string expected."), this->GetCurrentCharLexLocation() );
	case SCT_LineEnder:
		TesScannerError( mConfig, t("Unexpected end of line. Double quoted string expected."), this->GetCurrentCharLexLocation() );

	case SCT_DoubleQuote:
		this->AddToken( TesToken( TTT_String, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		return SS_Normal;

	case SCT_Backslash:
		return SS_InDoubleQuoteEscapeSequence;

	case SCT_SingleQuote:
	case SCT_TabOrSpace:
	case SCT_Semicolon:
	case SCT_AlphaOrUnderscore:
	case SCT_Digit:
	case SCT_OpenParenthese:
	case SCT_CloseParenthese:
	case SCT_OpenBracket:
	case SCT_CloseBracket:
	case SCT_OpenBrace:
	case SCT_CloseBrace:
	case SCT_Add:
	case SCT_Star:
	case SCT_Slash:
	case SCT_Power:
	case SCT_Percent:
	case SCT_Sharp:
	case SCT_Colon:
	case SCT_Comma:
	case SCT_Minus:
	case SCT_Dot:
	case SCT_Less:
	case SCT_Greater:
	case SCT_Equal:
	case SCT_Unequal:
	case SCT_Other:
		this->AppendCharToCurrentString( ch );
		return SS_InDoubleQuoteString;

	default:
		TesScannerError( mConfig, t("Invalid character detected."), this->GetCurrentCharLexLocation() );
	}

	return SS_InvalidState;
}


TesScanner::ScanState TesScanner::ProcessState_InSingleQuoteEscapeSequence( tchar ch )
{
	ScanCharType type = GetScanCharType( ch );

	switch( type )
	{
	case SCT_AlphaOrUnderscore:
		switch( ch )
		{
		case t('a'):
			this->AppendCharToCurrentString( t('\a') );
			return SS_InSingleQuoteString;
		case t('b'):
			this->AppendCharToCurrentString( t('\b') );
			return SS_InSingleQuoteString;
		case t('f'):
			this->AppendCharToCurrentString( t('\f') );
			return SS_InSingleQuoteString;
		case t('n'):
			this->AppendCharToCurrentString( t('\n') );
			return SS_InSingleQuoteString;
		case t('r'):
			this->AppendCharToCurrentString( t('\r') );
			return SS_InSingleQuoteString;
		case t('t'):
			this->AppendCharToCurrentString( t('\t') );
			return SS_InSingleQuoteString;
		case t('v'):
			this->AppendCharToCurrentString( t('\v') );
			return SS_InSingleQuoteString;
		default:
			TesScannerError( mConfig, t("Invalid escape char detected."), this->GetCurrentCharLexLocation() );
		}

	case SCT_DoubleQuote:
		this->AppendCharToCurrentString( t('\"') );
		return SS_InSingleQuoteString;

	case SCT_Backslash:
		this->AppendCharToCurrentString( t('\\') );
		return SS_InSingleQuoteString;

	case SCT_Null:
		TesScannerError( mConfig, t("Unexpected end of file. Escape character in single quoted string expected."), this->GetCurrentCharLexLocation() );
	case SCT_LineEnder:
		TesScannerError( mConfig, t("Unexpected end of line. Escape character in single quoted string expected."), this->GetCurrentCharLexLocation() );

	case SCT_Digit:
		if( ch == t('8') || ch == t('9') )
		{
			TesScannerError( mConfig, t("Octal digit must be less than 8."), this->GetCurrentCharLexLocation() );
		}
		else
		{
			mCurrentEscapeString += ch;
		}
		return SS_OneEscapeDigitPassedInSingle;
		
	case SCT_SingleQuote:
	case SCT_TabOrSpace:
	case SCT_Semicolon:
	case SCT_OpenParenthese:
	case SCT_CloseParenthese:
	case SCT_OpenBracket:
	case SCT_CloseBracket:
	case SCT_OpenBrace:
	case SCT_CloseBrace:
	case SCT_Add:
	case SCT_Star:
	case SCT_Slash:
	case SCT_Power:
	case SCT_Percent:
	case SCT_Sharp:
	case SCT_Colon:
	case SCT_Comma:
	case SCT_Minus:
	case SCT_Dot:
	case SCT_Less:
	case SCT_Greater:
	case SCT_Equal:
	case SCT_Unequal:
	case SCT_Other:
	default:
		TesScannerError( mConfig, t("Invalid escape char detected."), this->GetCurrentCharLexLocation() );
	}

	return SS_InvalidState;
}


TesScanner::ScanState TesScanner::ProcessState_OneEscapeDigitPassedInSingle( tchar ch )
{
	ScanCharType type = GetScanCharType( ch );

	switch( type )
	{
	case SCT_Null:
	case SCT_LineEnder:
		TesScannerError( mConfig, t("Unexpected end of file. Escape character in single quoted string expected."), this->GetCurrentCharLexLocation() );

	case SCT_Digit:
		if( ch == t('8') || ch == t('9') )
		{
			unsigned char escapeValue = TesScannerHelper::ScanOctal( mCurrentEscapeString );
			mCurrentEscapeString.clear();
			mCurrentString += escapeValue;
			mCurrentString += ch;
			return SS_InSingleQuoteString;
		}
		else
		{
			mCurrentEscapeString += ch;
		}
		return SS_TwoEscapeDigitPassedInSingle;

	case SCT_SingleQuote:
		{
			unsigned char escapeValue = TesScannerHelper::ScanOctal( mCurrentEscapeString );
			mCurrentEscapeString.clear();
			mCurrentString += escapeValue;
			return SS_InSingleQuoteString;
		}

	case SCT_DoubleQuote:
	case SCT_Backslash:
	case SCT_AlphaOrUnderscore:
	case SCT_TabOrSpace:
	case SCT_Semicolon:
	case SCT_OpenParenthese:
	case SCT_CloseParenthese:
	case SCT_OpenBracket:
	case SCT_CloseBracket:
	case SCT_OpenBrace:
	case SCT_CloseBrace:
	case SCT_Add:
	case SCT_Star:
	case SCT_Slash:
	case SCT_Power:
	case SCT_Percent:
	case SCT_Sharp:
	case SCT_Colon:
	case SCT_Comma:
	case SCT_Minus:
	case SCT_Dot:
	case SCT_Less:
	case SCT_Greater:
	case SCT_Equal:
	case SCT_Unequal:
	case SCT_Other:
	default:
		{
			unsigned char escapeValue = TesScannerHelper::ScanOctal( mCurrentEscapeString );
			mCurrentEscapeString.clear();
			mCurrentString += escapeValue;
			this->AppendCharToCurrentString( ch );
			return SS_InSingleQuoteString;
		}
	}
}


TesScanner::ScanState TesScanner::ProcessState_TwoEscapeDigitPassedInSingle( tchar ch )
{
	ScanCharType type = GetScanCharType( ch );

	switch( type )
	{
	case SCT_Null:
	case SCT_LineEnder:
		TesScannerError( mConfig, t("Unexpected end of file. Escape character in single quoted string expected."), this->GetCurrentCharLexLocation() );

	case SCT_Digit:
		if( ch == t('8') || ch == t('9') )
		{
			unsigned char escapeValue = TesScannerHelper::ScanOctal( mCurrentEscapeString );
			mCurrentEscapeString.clear();
			mCurrentString += escapeValue;
			mCurrentString += ch;
			return SS_InSingleQuoteString;
		}
		else
		{
			mCurrentEscapeString += ch;
			unsigned char escapeValue = TesScannerHelper::ScanOctal( mCurrentEscapeString );
			mCurrentEscapeString.clear();
			mCurrentString += escapeValue;
			return SS_InSingleQuoteString;
		}

	case SCT_SingleQuote:
		{
			unsigned char escapeValue = TesScannerHelper::ScanOctal( mCurrentEscapeString );
			mCurrentEscapeString.clear();
			mCurrentString += escapeValue;
			return SS_InSingleQuoteString;
		}

	case SCT_DoubleQuote:
	case SCT_Backslash:
	case SCT_AlphaOrUnderscore:
	case SCT_TabOrSpace:
	case SCT_Semicolon:
	case SCT_OpenParenthese:
	case SCT_CloseParenthese:
	case SCT_OpenBracket:
	case SCT_CloseBracket:
	case SCT_OpenBrace:
	case SCT_CloseBrace:
	case SCT_Add:
	case SCT_Star:
	case SCT_Slash:
	case SCT_Power:
	case SCT_Percent:
	case SCT_Sharp:
	case SCT_Colon:
	case SCT_Comma:
	case SCT_Minus:
	case SCT_Dot:
	case SCT_Less:
	case SCT_Greater:
	case SCT_Equal:
	case SCT_Unequal:
	case SCT_Other:
	default:
		{
			unsigned char escapeValue = TesScannerHelper::ScanOctal( mCurrentEscapeString );
			mCurrentEscapeString.clear();
			mCurrentString += escapeValue;
			this->AppendCharToCurrentString( ch );
			return SS_InSingleQuoteString;
		}
	}
}


TesScanner::ScanState TesScanner::ProcessState_OneEscapeDigitPassedInDouble( tchar ch )
{
	ScanCharType type = GetScanCharType( ch );

	switch( type )
	{
	case SCT_Null:
	case SCT_LineEnder:
		TesScannerError( mConfig, t("Unexpected end of file. Escape character in double quoted string expected."), this->GetCurrentCharLexLocation() );

	case SCT_Digit:
		if( ch == t('8') || ch == t('9') )
		{
			unsigned char escapeValue = TesScannerHelper::ScanOctal( mCurrentEscapeString );
			mCurrentEscapeString.clear();
			mCurrentString += escapeValue;
			mCurrentString += ch;
			return SS_InDoubleQuoteString;
		}
		else
		{
			mCurrentEscapeString += ch;
		}
		return SS_TwoEscapeDigitPassedInDouble;

	case SCT_DoubleQuote:
		{
			unsigned char escapeValue = TesScannerHelper::ScanOctal( mCurrentEscapeString );
			mCurrentEscapeString.clear();
			mCurrentString += escapeValue;
			return SS_InDoubleQuoteString;
		}

	case SCT_SingleQuote:
	case SCT_Backslash:
	case SCT_AlphaOrUnderscore:
	case SCT_TabOrSpace:
	case SCT_Semicolon:
	case SCT_OpenParenthese:
	case SCT_CloseParenthese:
	case SCT_OpenBracket:
	case SCT_CloseBracket:
	case SCT_OpenBrace:
	case SCT_CloseBrace:
	case SCT_Add:
	case SCT_Star:
	case SCT_Slash:
	case SCT_Power:
	case SCT_Percent:
	case SCT_Sharp:
	case SCT_Colon:
	case SCT_Comma:
	case SCT_Minus:
	case SCT_Dot:
	case SCT_Less:
	case SCT_Greater:
	case SCT_Equal:
	case SCT_Unequal:
	case SCT_Other:
	default:
		{
			unsigned char escapeValue = TesScannerHelper::ScanOctal( mCurrentEscapeString );
			mCurrentEscapeString.clear();
			mCurrentString += escapeValue;
			this->AppendCharToCurrentString( ch );
			return SS_InDoubleQuoteString;
		}
	}
}


TesScanner::ScanState TesScanner::ProcessState_TwoEscapeDigitPassedInDouble( tchar ch )
{
	ScanCharType type = GetScanCharType( ch );

	switch( type )
	{
	case SCT_Null:
	case SCT_LineEnder:
		TesScannerError( mConfig, t("Unexpected end of file. Escape character in single quoted string expected."), this->GetCurrentCharLexLocation() );

	case SCT_Digit:
		if( ch == t('8') || ch == t('9') )
		{
			unsigned char escapeValue = TesScannerHelper::ScanOctal( mCurrentEscapeString );
			mCurrentEscapeString.clear();
			mCurrentString += escapeValue;
			mCurrentString += ch;
			return SS_InDoubleQuoteString;
		}
		else
		{
			mCurrentEscapeString += ch;
			unsigned char escapeValue = TesScannerHelper::ScanOctal( mCurrentEscapeString );
			mCurrentEscapeString.clear();
			mCurrentString += escapeValue;
			return SS_InDoubleQuoteString;
		}

	case SCT_DoubleQuote:
		{
			unsigned char escapeValue = TesScannerHelper::ScanOctal( mCurrentEscapeString );
			mCurrentEscapeString.clear();
			mCurrentString += escapeValue;
			return SS_InDoubleQuoteString;
		}

	case SCT_SingleQuote:
	case SCT_Backslash:
	case SCT_AlphaOrUnderscore:
	case SCT_TabOrSpace:
	case SCT_Semicolon:
	case SCT_OpenParenthese:
	case SCT_CloseParenthese:
	case SCT_OpenBracket:
	case SCT_CloseBracket:
	case SCT_OpenBrace:
	case SCT_CloseBrace:
	case SCT_Add:
	case SCT_Star:
	case SCT_Slash:
	case SCT_Power:
	case SCT_Percent:
	case SCT_Sharp:
	case SCT_Colon:
	case SCT_Comma:
	case SCT_Minus:
	case SCT_Dot:
	case SCT_Less:
	case SCT_Greater:
	case SCT_Equal:
	case SCT_Unequal:
	case SCT_Other:
	default:
		{
			unsigned char escapeValue = TesScannerHelper::ScanOctal( mCurrentEscapeString );
			mCurrentEscapeString.clear();
			mCurrentString += escapeValue;
			this->AppendCharToCurrentString( ch );
			return SS_InDoubleQuoteString;
		}
	}
}


TesScanner::ScanState TesScanner::ProcessState_InDoubleQuoteEscapeSequence( tchar ch )
{
	ScanCharType type = GetScanCharType( ch );

	switch( type )
	{
	case SCT_AlphaOrUnderscore:
		switch( ch )
		{
		case t('a'):
			this->AppendCharToCurrentString( t('\a') );
			return SS_InDoubleQuoteString;
		case t('b'):
			this->AppendCharToCurrentString( t('\b') );
			return SS_InDoubleQuoteString;
		case t('f'):
			this->AppendCharToCurrentString( t('\f') );
			return SS_InDoubleQuoteString;
		case t('n'):
			this->AppendCharToCurrentString( t('\n') );
			return SS_InDoubleQuoteString;
		case t('r'):
			this->AppendCharToCurrentString( t('\r') );
			return SS_InDoubleQuoteString;
		case t('t'):
			this->AppendCharToCurrentString( t('\t') );
			return SS_InDoubleQuoteString;
		case t('v'):
			this->AppendCharToCurrentString( t('\v') );
			return SS_InDoubleQuoteString;
		default:
			TesScannerError( mConfig, t("Invalid escape char detected."), this->GetCurrentCharLexLocation() );
		}

	case SCT_SingleQuote:
		this->AppendCharToCurrentString( t('\'') );
		return SS_InDoubleQuoteString;

	case SCT_Backslash:
		this->AppendCharToCurrentString( t('\\') );
		return SS_InDoubleQuoteString;

	case SCT_Null:
		TesScannerError( mConfig, t("Unexpected end of file. Escape character in single quoted string expected."), this->GetCurrentCharLexLocation() );
	case SCT_LineEnder:
		TesScannerError( mConfig, t("Unexpected end of line. Escape character in single quoted string expected."), this->GetCurrentCharLexLocation() );

	case SCT_Digit:
		if( ch == t('8') || ch == t('9') )
		{
			TesScannerError( mConfig, t("Octal digit must be less than 8."), this->GetCurrentCharLexLocation() );
		}
		else
		{
			mCurrentEscapeString += ch;
		}
		return SS_OneEscapeDigitPassedInDouble;

	case SCT_DoubleQuote:
	case SCT_TabOrSpace:
	case SCT_Semicolon:
	case SCT_OpenParenthese:
	case SCT_CloseParenthese:
	case SCT_OpenBracket:
	case SCT_CloseBracket:
	case SCT_OpenBrace:
	case SCT_CloseBrace:
	case SCT_Add:
	case SCT_Star:
	case SCT_Slash:
	case SCT_Power:
	case SCT_Percent:
	case SCT_Sharp:
	case SCT_Colon:
	case SCT_Comma:
	case SCT_Minus:
	case SCT_Dot:
	case SCT_Less:
	case SCT_Greater:
	case SCT_Equal:
	case SCT_Unequal:
	case SCT_Other:
	default:
		TesScannerError( mConfig, t("Invalid escape char detected."), this->GetCurrentCharLexLocation() );
	}

	return SS_InvalidState;
}


TesScanner::ScanState TesScanner::ProcessState_InDecimal( tchar ch )
{
	ScanCharType type = GetScanCharType( ch );

	switch( type )
	{
	case SCT_Null:
	case SCT_TabOrSpace:
	case SCT_LineEnder:
		this->AddToken( TesToken( TTT_Decimal, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		return SS_Normal;

	case SCT_Semicolon:
		this->AddToken( TesToken( TTT_Decimal, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpSemicolon, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;

	case SCT_AlphaOrUnderscore:
		if(	ch == t('_') )
		{
			return SS_InDecimal;
		}
		else if( ch == t('e') || ch == t('E') )
		{
			return SS_EnterScientific;
		}
		else
		{
			this->AddToken( TesToken( TTT_Decimal, this->GetStringBeginLexLocation(), mCurrentString ) );
			this->ClearCurrentString();
			this->AppendCharToCurrentString( ch );
			return SS_InIdentifier;
		}

	case SCT_Digit:
		this->AppendCharToCurrentString( ch );
		return SS_InDecimal;
	case SCT_Dot:
		this->AppendCharToCurrentString( ch );
		return SS_EnterDouble;

	case SCT_SingleQuote:
		this->AddToken( TesToken( TTT_Decimal, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		return SS_InSingleQuoteString;
	case SCT_DoubleQuote:
		this->AddToken( TesToken( TTT_Decimal, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		return SS_InDoubleQuoteString;

	case SCT_OpenParenthese:
		this->AddToken( TesToken( TTT_Decimal, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpenParenthese, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_CloseParenthese:
		this->AddToken( TesToken( TTT_Decimal, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_CloseParenthese, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_OpenBracket:
		this->AddToken( TesToken( TTT_Decimal, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpenBracket, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_CloseBracket:
		this->AddToken( TesToken( TTT_Decimal, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_CloseBracket, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_OpenBrace:
		this->AddToken( TesToken( TTT_Decimal, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpenBrace, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_CloseBrace:
		this->AddToken( TesToken( TTT_Decimal, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_CloseBrace, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;

	case SCT_Add:
		this->AddToken( TesToken( TTT_Decimal, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpAdd, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_Star:
		this->AddToken( TesToken( TTT_Decimal, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpMultiply, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_Slash:
		this->AddToken( TesToken( TTT_Decimal, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpDivide, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_Power:
		this->AddToken( TesToken( TTT_Decimal, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpPower, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_Percent:
		this->AddToken( TesToken( TTT_Decimal, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpMod, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_Sharp:
		this->AddToken( TesToken( TTT_Decimal, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		return SS_InLineComment;
	case SCT_Colon:
		this->AddToken( TesToken( TTT_Decimal, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpObjectMemberAccess, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_Comma:
		this->AddToken( TesToken( TTT_Decimal, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpComma, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;

	case SCT_Minus:
		this->AddToken( TesToken( TTT_Decimal, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpMinus, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_Less:
		this->AddToken( TesToken( TTT_Decimal, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		this->AppendCharToCurrentString( ch );
		return SS_OneLessPassed;
	case SCT_Greater:
		this->AddToken( TesToken( TTT_Decimal, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		this->AppendCharToCurrentString( ch );
		return SS_OneGreaterPassed;
	case SCT_Equal:
		this->AddToken( TesToken( TTT_Decimal, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		this->AppendCharToCurrentString( ch );
		return SS_OneEqualPassed;
	case SCT_Unequal:
		this->AddToken( TesToken( TTT_Decimal, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		this->AppendCharToCurrentString( ch );
		return SS_OneUnequalPassed;

	case SCT_Backslash:
	case SCT_Other:
	default:
		TesScannerError( mConfig, t("Invalid character detected."), this->GetCurrentCharLexLocation() );
	}

	return SS_InvalidState;
}


TesScanner::ScanState TesScanner::ProcessState_EnterDouble( tchar ch )
{
	ScanCharType type = GetScanCharType( ch );

	switch( type )
	{
	case SCT_Null:
	case SCT_TabOrSpace:
	case SCT_LineEnder:
		this->AddToken( TesToken( TTT_Double, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		return SS_Normal;
	case SCT_Semicolon:
		this->AddToken( TesToken( TTT_Double, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpSemicolon, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_AlphaOrUnderscore:
		if( ch == t('e') || ch == t('E') )
		{
			return SS_EnterScientific;
		}
		this->AddToken( TesToken( TTT_Double, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		this->AppendCharToCurrentString( ch );
		return SS_InIdentifier;
	case SCT_Digit:
		this->AppendCharToCurrentString( ch );
		return SS_InDouble;

	case SCT_SingleQuote:
		this->AddToken( TesToken( TTT_Double, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		return SS_InSingleQuoteString;
	case SCT_DoubleQuote:
		this->AddToken( TesToken( TTT_Double, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		return SS_InDoubleQuoteString;

	case SCT_OpenParenthese:
		this->AddToken( TesToken( TTT_Double, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpenParenthese, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_CloseParenthese:
		this->AddToken( TesToken( TTT_Double, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_CloseParenthese, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_OpenBracket:
		this->AddToken( TesToken( TTT_Double, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpenBracket, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_CloseBracket:
		this->AddToken( TesToken( TTT_Double, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_CloseBracket, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_OpenBrace:
		this->AddToken( TesToken( TTT_Double, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpenBrace, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_CloseBrace:
		this->AddToken( TesToken( TTT_Double, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_CloseBrace, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;

	case SCT_Add:
		this->AddToken( TesToken( TTT_Double, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpAdd, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_Star:
		this->AddToken( TesToken( TTT_Double, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpMultiply, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_Slash:
		this->AddToken( TesToken( TTT_Double, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpDivide, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_Power:
		this->AddToken( TesToken( TTT_Double, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpPower, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_Percent:
		this->AddToken( TesToken( TTT_Double, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpMod, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_Sharp:
		this->AddToken( TesToken( TTT_Double, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		return SS_InLineComment;
	case SCT_Colon:
		this->AddToken( TesToken( TTT_Double, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpObjectMemberAccess, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_Comma:
		this->AddToken( TesToken( TTT_Double, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpComma, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;

	case SCT_Less:
		this->AddToken( TesToken( TTT_Double, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		return SS_OneLessPassed;
	case SCT_Greater:
		this->AddToken( TesToken( TTT_Double, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		return SS_OneGreaterPassed;
	case SCT_Unequal:
		this->AddToken( TesToken( TTT_Double, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		return SS_OneUnequalPassed;
	case SCT_Equal:
		this->AddToken( TesToken( TTT_Double, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		return SS_OneEqualPassed;
	case SCT_Minus:
		this->AddToken( TesToken( TTT_Double, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		return SS_InLineComment;

	case SCT_Dot:
		this->AddToken( TesToken( TTT_Decimal, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		return SS_TwoDotPassed;

	case SCT_Backslash:
	case SCT_Other:
	default:
		TesScannerError( mConfig, t("Invalid character detected."), this->GetCurrentCharLexLocation() );
	}

	return SS_InvalidState;
}


TesScanner::ScanState TesScanner::ProcessState_EnterScientific( tchar ch )
{
	ScanCharType type = GetScanCharType( ch );

	switch( type )
	{
	case SCT_Digit:
		this->AppendCharToCurrentString( t('e') );
		this->AppendCharToCurrentString( ch );
		return SS_InExponent;

	case SCT_Add:
	case SCT_Minus:
		this->AppendCharToCurrentString( t('e') );
		this->AppendCharToCurrentString( ch );
		return SS_EnterExponent;

	case SCT_Null:
	case SCT_TabOrSpace:
	case SCT_LineEnder:
	case SCT_Semicolon:
	case SCT_AlphaOrUnderscore:
	case SCT_SingleQuote:
	case SCT_DoubleQuote:
	case SCT_OpenParenthese:
	case SCT_CloseParenthese:
	case SCT_OpenBracket:
	case SCT_CloseBracket:
	case SCT_OpenBrace:
	case SCT_CloseBrace:
	case SCT_Star:
	case SCT_Slash:
	case SCT_Power:
	case SCT_Percent:
	case SCT_Sharp:
	case SCT_Colon:
	case SCT_Comma:
	case SCT_Less:
	case SCT_Greater:
	case SCT_Unequal:
	case SCT_Equal:
	case SCT_Dot:
	case SCT_Backslash:
	case SCT_Other:
	default:
		TesScannerError( mConfig, t("Exponent part expected."), this->GetCurrentCharLexLocation() );
	}

	return SS_InvalidState;
}


TesScanner::ScanState TesScanner::ProcessState_InDouble( tchar ch )
{
	ScanCharType type = GetScanCharType( ch );

	switch( type )
	{
	case SCT_Null:
	case SCT_TabOrSpace:
	case SCT_LineEnder:
		this->AddToken( TesToken( TTT_Double, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		return SS_Normal;
	case SCT_Semicolon:
		this->AddToken( TesToken( TTT_Double, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpSemicolon, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_AlphaOrUnderscore:
		if( ch == t('e') || ch == t('E') )
		{
			return SS_EnterScientific;
		}
		this->AddToken( TesToken( TTT_Double, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		this->AppendCharToCurrentString( ch );
		return SS_InIdentifier;
	case SCT_Digit:
		this->AppendCharToCurrentString( ch );
		return SS_InDouble;

	case SCT_SingleQuote:
		this->AddToken( TesToken( TTT_Double, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		return SS_InSingleQuoteString;
	case SCT_DoubleQuote:
		this->AddToken( TesToken( TTT_Double, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		return SS_InDoubleQuoteString;

	case SCT_OpenParenthese:
		this->AddToken( TesToken( TTT_Double, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpenParenthese, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_CloseParenthese:
		this->AddToken( TesToken( TTT_Double, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_CloseParenthese, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_OpenBracket:
		this->AddToken( TesToken( TTT_Double, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpenBracket, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_CloseBracket:
		this->AddToken( TesToken( TTT_Double, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_CloseBracket, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_OpenBrace:
		this->AddToken( TesToken( TTT_Double, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpenBrace, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_CloseBrace:
		this->AddToken( TesToken( TTT_Double, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_CloseBrace, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;

	case SCT_Add:
		this->AddToken( TesToken( TTT_Double, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpAdd, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_Star:
		this->AddToken( TesToken( TTT_Double, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpMultiply, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_Slash:
		this->AddToken( TesToken( TTT_Double, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpDivide, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_Power:
		this->AddToken( TesToken( TTT_Double, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpPower, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_Percent:
		this->AddToken( TesToken( TTT_Double, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpMod, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_Sharp:
		this->AddToken( TesToken( TTT_Double, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		return SS_InLineComment;
	case SCT_Colon:
		this->AddToken( TesToken( TTT_Double, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpObjectMemberAccess, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_Comma:
		this->AddToken( TesToken( TTT_Double, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpComma, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;

	case SCT_Less:
		this->AddToken( TesToken( TTT_Double, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		return SS_OneLessPassed;
	case SCT_Greater:
		this->AddToken( TesToken( TTT_Double, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		return SS_OneGreaterPassed;
	case SCT_Unequal:
		this->AddToken( TesToken( TTT_Double, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		return SS_OneUnequalPassed;
	case SCT_Equal:
		this->AddToken( TesToken( TTT_Double, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		return SS_OneEqualPassed;
	case SCT_Minus:
		this->AddToken( TesToken( TTT_Double, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		return SS_InLineComment;

	case SCT_Dot:
		this->AddToken( TesToken( TTT_Double, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		return SS_OneDotPassed;

	case SCT_Backslash:
	case SCT_Other:
	default:
		TesScannerError( mConfig, t("Invalid character detected."), this->GetCurrentCharLexLocation() );
	}

	return SS_InvalidState;
}


TesScanner::ScanState TesScanner::ProcessState_InExponent( tchar ch )
{
	ScanCharType type = GetScanCharType( ch );

	switch( type )
	{
	case SCT_Null:
	case SCT_TabOrSpace:
	case SCT_LineEnder:
		this->AddToken( TesToken( TTT_Scientific, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		return SS_Normal;
	case SCT_Semicolon:
		this->AddToken( TesToken( TTT_Scientific, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpSemicolon, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_AlphaOrUnderscore:
		this->AddToken( TesToken( TTT_Scientific, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		this->AppendCharToCurrentString( ch );
		return SS_InIdentifier;
	case SCT_Digit:
		this->AppendCharToCurrentString( ch );
		return SS_InExponent;

	case SCT_SingleQuote:
		this->AddToken( TesToken( TTT_Scientific, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		return SS_InSingleQuoteString;
	case SCT_DoubleQuote:
		this->AddToken( TesToken( TTT_Scientific, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		return SS_InDoubleQuoteString;

	case SCT_OpenParenthese:
		this->AddToken( TesToken( TTT_Scientific, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpenParenthese, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_CloseParenthese:
		this->AddToken( TesToken( TTT_Scientific, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_CloseParenthese, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_OpenBracket:
		this->AddToken( TesToken( TTT_Scientific, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpenBracket, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_CloseBracket:
		this->AddToken( TesToken( TTT_Scientific, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_CloseBracket, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_OpenBrace:
		this->AddToken( TesToken( TTT_Scientific, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpenBrace, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_CloseBrace:
		this->AddToken( TesToken( TTT_Scientific, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_CloseBrace, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;

	case SCT_Add:
		this->AddToken( TesToken( TTT_Scientific, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpAdd, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_Star:
		this->AddToken( TesToken( TTT_Scientific, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpMultiply, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_Slash:
		this->AddToken( TesToken( TTT_Scientific, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpDivide, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_Power:
		this->AddToken( TesToken( TTT_Scientific, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpPower, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_Percent:
		this->AddToken( TesToken( TTT_Scientific, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpMod, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_Sharp:
		this->AddToken( TesToken( TTT_Scientific, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		return SS_InLineComment;
	case SCT_Colon:
		this->AddToken( TesToken( TTT_Scientific, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpObjectMemberAccess, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_Comma:
		this->AddToken( TesToken( TTT_Scientific, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpComma, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;

	case SCT_Less:
		this->AddToken( TesToken( TTT_Scientific, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		return SS_OneLessPassed;
	case SCT_Greater:
		this->AddToken( TesToken( TTT_Scientific, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		return SS_OneGreaterPassed;
	case SCT_Unequal:
		this->AddToken( TesToken( TTT_Scientific, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		return SS_OneUnequalPassed;
	case SCT_Equal:
		this->AddToken( TesToken( TTT_Scientific, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		return SS_OneEqualPassed;
	case SCT_Minus:
		this->AddToken( TesToken( TTT_Scientific, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		return SS_InLineComment;

	case SCT_Dot:
		this->AddToken( TesToken( TTT_Scientific, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		return SS_OneDotPassed;

	case SCT_Backslash:
	case SCT_Other:
	default:
		TesScannerError( mConfig, t("Invalid character detected."), this->GetCurrentCharLexLocation() );
	}

	return SS_InvalidState;
}


TesScanner::ScanState TesScanner::ProcessState_EnterExponent( tchar ch )
{
	ScanCharType type = GetScanCharType( ch );

	switch( type )
	{
	case SCT_Digit:
		this->AppendCharToCurrentString( ch );
		return SS_InExponent;

	case SCT_Add:
	case SCT_Minus:
	case SCT_Null:
	case SCT_TabOrSpace:
	case SCT_LineEnder:
	case SCT_Semicolon:
	case SCT_AlphaOrUnderscore:
	case SCT_SingleQuote:
	case SCT_DoubleQuote:
	case SCT_OpenParenthese:
	case SCT_CloseParenthese:
	case SCT_OpenBracket:
	case SCT_CloseBracket:
	case SCT_OpenBrace:
	case SCT_CloseBrace:
	case SCT_Star:
	case SCT_Slash:
	case SCT_Power:
	case SCT_Percent:
	case SCT_Sharp:
	case SCT_Colon:
	case SCT_Comma:
	case SCT_Less:
	case SCT_Greater:
	case SCT_Unequal:
	case SCT_Equal:
	case SCT_Dot:
	case SCT_Backslash:
	case SCT_Other:
	default:
		TesScannerError( mConfig, t("Exponent expected."), this->GetCurrentCharLexLocation() );
	}

	return SS_InvalidState;
}


TesScanner::ScanState TesScanner::ProcessState_OneZeroPassed( tchar ch )
{
	ScanCharType type = GetScanCharType( ch );

	switch( type )
	{
	case SCT_Null:
	case SCT_TabOrSpace:
	case SCT_LineEnder:
		this->AddToken( TesToken( TTT_Decimal, this->GetStringBeginLexLocation(), t("0") ) );
		this->ClearCurrentString();
		return SS_Normal;

	case SCT_Semicolon:
		this->AddToken( TesToken( TTT_Decimal, this->GetStringBeginLexLocation(), t("0") ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpSemicolon, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;

	case SCT_AlphaOrUnderscore:
		if(	ch == t('_') )
		{
			return SS_InOctal;
		}
		else
		{
			if( ch == t('x') || ch == t('X') )
			{
				return SS_InHexadecimal;
			}
			else
			{
				this->AddToken( TesToken( TTT_Decimal, this->GetStringBeginLexLocation(), t("0") ) );
				this->ClearCurrentString();
				this->AppendCharToCurrentString( ch );
				return SS_InIdentifier;
			}
		}

	case SCT_Digit:
		if( ch == t('8') || ch == t('9') )
		{
			TesScannerError( mConfig, t("Octal digit must be less than 8."), this->GetCurrentCharLexLocation() );
		}
		else
		{
			this->AppendCharToCurrentString( ch );
			return SS_InOctal;
		}
	case SCT_Dot:
		this->AddToken( TesToken( TTT_Decimal, this->GetStringBeginLexLocation(), t("0") ) );
		this->ClearCurrentString();
		return SS_OneDotPassed;

	case SCT_SingleQuote:
		this->AddToken( TesToken( TTT_Decimal, this->GetStringBeginLexLocation(), t("0") ) );
		this->ClearCurrentString();
		return SS_InSingleQuoteString;
	case SCT_DoubleQuote:
		this->AddToken( TesToken( TTT_Decimal, this->GetStringBeginLexLocation(), t("0") ) );
		this->ClearCurrentString();
		return SS_InDoubleQuoteString;

	case SCT_OpenParenthese:
		this->AddToken( TesToken( TTT_Decimal, this->GetStringBeginLexLocation(), t("0") ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpenParenthese, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_CloseParenthese:
		this->AddToken( TesToken( TTT_Decimal, this->GetStringBeginLexLocation(), t("0") ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_CloseParenthese, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_OpenBracket:
		this->AddToken( TesToken( TTT_Decimal, this->GetStringBeginLexLocation(), t("0") ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpenBracket, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_CloseBracket:
		this->AddToken( TesToken( TTT_Decimal, this->GetStringBeginLexLocation(), t("0") ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_CloseBracket, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_OpenBrace:
		this->AddToken( TesToken( TTT_Decimal, this->GetStringBeginLexLocation(), t("0") ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpenBrace, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_CloseBrace:
		this->AddToken( TesToken( TTT_Decimal, this->GetStringBeginLexLocation(), t("0") ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_CloseBrace, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;

	case SCT_Add:
		this->AddToken( TesToken( TTT_Decimal, this->GetStringBeginLexLocation(), t("0") ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpAdd, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_Star:
		this->AddToken( TesToken( TTT_Decimal, this->GetStringBeginLexLocation(), t("0") ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpMultiply, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_Slash:
		this->AddToken( TesToken( TTT_Decimal, this->GetStringBeginLexLocation(), t("0") ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpDivide, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_Power:
		this->AddToken( TesToken( TTT_Decimal, this->GetStringBeginLexLocation(), t("0") ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpPower, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_Percent:
		this->AddToken( TesToken( TTT_Decimal, this->GetStringBeginLexLocation(), t("0") ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpMod, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_Sharp:
		this->AddToken( TesToken( TTT_Decimal, this->GetStringBeginLexLocation(), t("0") ) );
		this->ClearCurrentString();
		return SS_InLineComment;
	case SCT_Colon:
		this->AddToken( TesToken( TTT_Decimal, this->GetStringBeginLexLocation(), t("0") ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpObjectMemberAccess, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_Comma:
		this->AddToken( TesToken( TTT_Decimal, this->GetStringBeginLexLocation(), t("0") ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpComma, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;

	case SCT_Minus:
		this->AddToken( TesToken( TTT_Decimal, this->GetStringBeginLexLocation(), t("0") ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpMinus, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_Less:
		this->AddToken( TesToken( TTT_Decimal, this->GetStringBeginLexLocation(), t("0") ) );
		this->ClearCurrentString();
		this->AppendCharToCurrentString( ch );
		return SS_OneLessPassed;
	case SCT_Greater:
		this->AddToken( TesToken( TTT_Decimal, this->GetStringBeginLexLocation(), t("0") ) );
		this->ClearCurrentString();
		this->AppendCharToCurrentString( ch );
		return SS_OneGreaterPassed;
	case SCT_Equal:
		this->AddToken( TesToken( TTT_Decimal, this->GetStringBeginLexLocation(), t("0") ) );
		this->ClearCurrentString();
		this->AppendCharToCurrentString( ch );
		return SS_OneEqualPassed;
	case SCT_Unequal:
		this->AddToken( TesToken( TTT_Decimal, this->GetStringBeginLexLocation(), t("0") ) );
		this->ClearCurrentString();
		this->AppendCharToCurrentString( ch );
		return SS_OneUnequalPassed;

	case SCT_Backslash:
	case SCT_Other:
	default:
		TesScannerError( mConfig, t("Invalid character detected."), this->GetCurrentCharLexLocation() );
	}

	return SS_InvalidState;
}


TesScanner::ScanState TesScanner::ProcessState_InOctal( tchar ch )
{
	ScanCharType type = GetScanCharType( ch );

	switch( type )
	{
	case SCT_Null:
	case SCT_TabOrSpace:
	case SCT_LineEnder:
		this->AddToken( TesToken( TTT_Octal, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		return SS_Normal;

	case SCT_Semicolon:
		this->AddToken( TesToken( TTT_Octal, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpSemicolon, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;

	case SCT_AlphaOrUnderscore:
		if(	ch == t('_') )
		{
			return SS_InOctal;
		}
		else
		{
			this->AddToken( TesToken( TTT_Octal, this->GetStringBeginLexLocation(), mCurrentString ) );
			this->ClearCurrentString();
			this->AppendCharToCurrentString( ch );
			return SS_InIdentifier;
		}

	case SCT_Digit:
		if( ch == t('8') || ch == t('9') )
		{
			TesScannerError( mConfig, t("Octal digit must be less than 8."), this->GetCurrentCharLexLocation() );
		}
		else
		{
			this->AppendCharToCurrentString( ch );
			return SS_InOctal;
		}
	case SCT_Dot:
		this->AddToken( TesToken( TTT_Octal, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		return SS_OneDotPassed;

	case SCT_SingleQuote:
		this->AddToken( TesToken( TTT_Octal, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		return SS_InSingleQuoteString;
	case SCT_DoubleQuote:
		this->AddToken( TesToken( TTT_Octal, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		return SS_InDoubleQuoteString;

	case SCT_OpenParenthese:
		this->AddToken( TesToken( TTT_Octal, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpenParenthese, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_CloseParenthese:
		this->AddToken( TesToken( TTT_Octal, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_CloseParenthese, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_OpenBracket:
		this->AddToken( TesToken( TTT_Octal, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpenBracket, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_CloseBracket:
		this->AddToken( TesToken( TTT_Octal, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_CloseBracket, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_OpenBrace:
		this->AddToken( TesToken( TTT_Octal, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpenBrace, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_CloseBrace:
		this->AddToken( TesToken( TTT_Octal, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_CloseBrace, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;

	case SCT_Add:
		this->AddToken( TesToken( TTT_Octal, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpAdd, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_Star:
		this->AddToken( TesToken( TTT_Octal, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpMultiply, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_Slash:
		this->AddToken( TesToken( TTT_Octal, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpDivide, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_Power:
		this->AddToken( TesToken( TTT_Octal, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpPower, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_Percent:
		this->AddToken( TesToken( TTT_Octal, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpMod, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_Sharp:
		this->AddToken( TesToken( TTT_Octal, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		return SS_InLineComment;
	case SCT_Colon:
		this->AddToken( TesToken( TTT_Octal, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpObjectMemberAccess, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_Comma:
		this->AddToken( TesToken( TTT_Octal, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpComma, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;

	case SCT_Minus:
		this->AddToken( TesToken( TTT_Octal, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpMinus, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_Less:
		this->AddToken( TesToken( TTT_Octal, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		this->AppendCharToCurrentString( ch );
		return SS_OneLessPassed;
	case SCT_Greater:
		this->AddToken( TesToken( TTT_Octal, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		this->AppendCharToCurrentString( ch );
		return SS_OneGreaterPassed;
	case SCT_Equal:
		this->AddToken( TesToken( TTT_Octal, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		this->AppendCharToCurrentString( ch );
		return SS_OneEqualPassed;
	case SCT_Unequal:
		this->AddToken( TesToken( TTT_Octal, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		this->AppendCharToCurrentString( ch );
		return SS_OneUnequalPassed;

	case SCT_Backslash:
	case SCT_Other:
	default:
		TesScannerError( mConfig, t("Invalid character detected."), this->GetCurrentCharLexLocation() );
	}

	return SS_InvalidState;
}


TesScanner::ScanState TesScanner::ProcessState_InHexadecimal( tchar ch )
{
	ScanCharType type = GetScanCharType( ch );

	switch( type )
	{
	case SCT_Null:
	case SCT_TabOrSpace:
	case SCT_LineEnder:
		this->AddToken( TesToken( TTT_Hexadecimal, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		return SS_Normal;

	case SCT_Semicolon:
		this->AddToken( TesToken( TTT_Hexadecimal, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpSemicolon, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;

	case SCT_AlphaOrUnderscore:
		if(	ch == t('_') )
		{
			return SS_InOctal;
		}
		else
		{
			if( ( ch >= t('a') && ch <= t('f') ) || ( ch >= t('A') && ch <= t('F') ) )
			{
				this->AppendCharToCurrentString( ch );
				return SS_InHexadecimal;
			}
			else
			{
				this->AddToken( TesToken( TTT_Hexadecimal, this->GetStringBeginLexLocation(), mCurrentString ) );
				this->ClearCurrentString();
				this->AppendCharToCurrentString( ch );
				return SS_InIdentifier;
			}
		}

	case SCT_Digit:
		this->AppendCharToCurrentString( ch );
		return SS_InHexadecimal;

	case SCT_Dot:
		this->AddToken( TesToken( TTT_Hexadecimal, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		return SS_OneDotPassed;

	case SCT_SingleQuote:
		this->AddToken( TesToken( TTT_Hexadecimal, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		return SS_InSingleQuoteString;
	case SCT_DoubleQuote:
		this->AddToken( TesToken( TTT_Hexadecimal, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		return SS_InDoubleQuoteString;

	case SCT_OpenParenthese:
		this->AddToken( TesToken( TTT_Hexadecimal, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpenParenthese, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_CloseParenthese:
		this->AddToken( TesToken( TTT_Hexadecimal, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_CloseParenthese, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_OpenBracket:
		this->AddToken( TesToken( TTT_Hexadecimal, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpenBracket, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_CloseBracket:
		this->AddToken( TesToken( TTT_Hexadecimal, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_CloseBracket, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_OpenBrace:
		this->AddToken( TesToken( TTT_Hexadecimal, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpenBrace, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_CloseBrace:
		this->AddToken( TesToken( TTT_Hexadecimal, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_CloseBrace, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;

	case SCT_Add:
		this->AddToken( TesToken( TTT_Hexadecimal, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpAdd, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_Star:
		this->AddToken( TesToken( TTT_Hexadecimal, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpMultiply, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_Slash:
		this->AddToken( TesToken( TTT_Hexadecimal, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpDivide, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_Power:
		this->AddToken( TesToken( TTT_Hexadecimal, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpPower, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_Percent:
		this->AddToken( TesToken( TTT_Hexadecimal, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpMod, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_Sharp:
		this->AddToken( TesToken( TTT_Hexadecimal, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		return SS_InLineComment;
	case SCT_Colon:
		this->AddToken( TesToken( TTT_Hexadecimal, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpObjectMemberAccess, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_Comma:
		this->AddToken( TesToken( TTT_Hexadecimal, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpComma, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;

	case SCT_Minus:
		this->AddToken( TesToken( TTT_Hexadecimal, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpMinus, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_Less:
		this->AddToken( TesToken( TTT_Hexadecimal, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		this->AppendCharToCurrentString( ch );
		return SS_OneLessPassed;
	case SCT_Greater:
		this->AddToken( TesToken( TTT_Hexadecimal, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		this->AppendCharToCurrentString( ch );
		return SS_OneGreaterPassed;
	case SCT_Equal:
		this->AddToken( TesToken( TTT_Hexadecimal, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		this->AppendCharToCurrentString( ch );
		return SS_OneEqualPassed;
	case SCT_Unequal:
		this->AddToken( TesToken( TTT_Hexadecimal, this->GetStringBeginLexLocation(), mCurrentString ) );
		this->ClearCurrentString();
		this->AppendCharToCurrentString( ch );
		return SS_OneUnequalPassed;

	case SCT_Backslash:
	case SCT_Other:
	default:
		TesScannerError( mConfig, t("Invalid character detected."), this->GetCurrentCharLexLocation() );
	}

	return SS_InvalidState;
}


TesScanner::ScanState TesScanner::ProcessState_InIdentifier( tchar ch )
{
	ScanCharType type = GetScanCharType( ch );

	switch( type )
	{
	case SCT_Null:
	case SCT_TabOrSpace:
	case SCT_LineEnder:
		this->AddIdentifierOrKeyword();
		this->ClearCurrentString();
		return SS_Normal;

	case SCT_Semicolon:
		this->AddIdentifierOrKeyword();
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpSemicolon, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;

	case SCT_AlphaOrUnderscore:
	case SCT_Digit:
		this->AppendCharToCurrentString( ch );
		return SS_InIdentifier;

	case SCT_SingleQuote:
		this->AddIdentifierOrKeyword();
		this->ClearCurrentString();
		return SS_InSingleQuoteString;
	case SCT_DoubleQuote:
		this->AddIdentifierOrKeyword();
		this->ClearCurrentString();
		return SS_InDoubleQuoteString;

	case SCT_OpenParenthese:
		this->AddIdentifierOrKeyword();
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpenParenthese, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_CloseParenthese:
		this->AddIdentifierOrKeyword();
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_CloseParenthese, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_OpenBracket:
		this->AddIdentifierOrKeyword();
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpenBracket, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_CloseBracket:
		this->AddIdentifierOrKeyword();
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_CloseBracket, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_OpenBrace:
		this->AddIdentifierOrKeyword();
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpenBrace, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_CloseBrace:
		this->AddIdentifierOrKeyword();
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_CloseBrace, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;

	case SCT_Add:
		this->AddIdentifierOrKeyword();
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpAdd, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_Star:
		this->AddIdentifierOrKeyword();
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpMultiply, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_Slash:
		this->AddIdentifierOrKeyword();
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpDivide, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_Power:
		this->AddIdentifierOrKeyword();
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpPower, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_Percent:
		this->AddIdentifierOrKeyword();
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpMod, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_Sharp:
		this->AddIdentifierOrKeyword();
		this->ClearCurrentString();
		return SS_InLineComment;
	case SCT_Colon:
		this->AddIdentifierOrKeyword();
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpObjectMemberAccess, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_Comma:
		this->AddIdentifierOrKeyword();
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpComma, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;

	case SCT_Dot:
		this->AddIdentifierOrKeyword();
		this->ClearCurrentString();
		this->AppendCharToCurrentString( ch );
		return SS_OneDotPassed;
	case SCT_Minus:
		this->AddIdentifierOrKeyword();
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpMinus, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_Less:
		this->AddIdentifierOrKeyword();
		this->ClearCurrentString();
		this->AppendCharToCurrentString( ch );
		return SS_OneLessPassed;
	case SCT_Greater:
		this->AddIdentifierOrKeyword();
		this->ClearCurrentString();
		this->AppendCharToCurrentString( ch );
		return SS_OneGreaterPassed;
	case SCT_Equal:
		this->AddIdentifierOrKeyword();
		this->ClearCurrentString();
		this->AppendCharToCurrentString( ch );
		return SS_OneEqualPassed;
	case SCT_Unequal:
		this->AddIdentifierOrKeyword();
		this->ClearCurrentString();
		this->AppendCharToCurrentString( ch );
		return SS_OneUnequalPassed;

	case SCT_Backslash:
	case SCT_Other:
	default:
		TesScannerError( mConfig, t("Invalid character detected."), this->GetCurrentCharLexLocation() );
	}

	return SS_InvalidState;
}


TesScanner::ScanState TesScanner::ProcessState_InLineComment( tchar ch )
{
	ScanCharType type = GetScanCharType( ch );

	switch( type )
	{
	case SCT_LineEnder:
		this->ClearCurrentString();
		return SS_Normal;
	default:
		return SS_InLineComment;
	}
}


TesScanner::ScanState TesScanner::ProcessState_OneEqualPassed( tchar ch )
{
	ScanCharType type = GetScanCharType( ch );

	switch( type )
	{
	case SCT_Null:
	case SCT_TabOrSpace:
	case SCT_LineEnder:
		this->AddToken( TesToken( TTT_OpAssign, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		return SS_Normal;
	case SCT_Semicolon:
		this->AddToken( TesToken( TTT_OpAssign, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpSemicolon, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_AlphaOrUnderscore:
		this->AddToken( TesToken( TTT_OpAssign, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		this->AppendCharToCurrentString( ch );
		return SS_InIdentifier;
	case SCT_Digit:
		this->AddToken( TesToken( TTT_OpAssign, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		if( ch == t('0') )
		{
			return SS_OneZeroPassed;
		}
		else
		{
			this->AppendCharToCurrentString( ch );
			return SS_InDecimal;
		}

	case SCT_SingleQuote:
		this->AddToken( TesToken( TTT_OpAssign, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		return SS_InSingleQuoteString;
	case SCT_DoubleQuote:
		this->AddToken( TesToken( TTT_OpAssign, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		return SS_InDoubleQuoteString;

	case SCT_OpenParenthese:
		this->AddToken( TesToken( TTT_OpAssign, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpenParenthese, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_CloseParenthese:
		this->AddToken( TesToken( TTT_OpAssign, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_CloseParenthese, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_OpenBracket:
		this->AddToken( TesToken( TTT_OpAssign, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpenBracket, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_CloseBracket:
		this->AddToken( TesToken( TTT_OpAssign, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_CloseBracket, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_OpenBrace:
		this->AddToken( TesToken( TTT_OpAssign, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpenBrace, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_CloseBrace:
		this->AddToken( TesToken( TTT_OpAssign, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_CloseBrace, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;

	case SCT_Add:
		this->AddToken( TesToken( TTT_OpAssign, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpAdd, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_Star:
		this->AddToken( TesToken( TTT_OpAssign, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpMultiply, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_Slash:
		this->AddToken( TesToken( TTT_OpAssign, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpDivide, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_Power:
		this->AddToken( TesToken( TTT_OpAssign, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpPower, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_Percent:
		this->AddToken( TesToken( TTT_OpAssign, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpMod, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_Sharp:
		this->AddToken( TesToken( TTT_OpAssign, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		return SS_InLineComment;
	case SCT_Colon:
		this->AddToken( TesToken( TTT_OpAssign, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpObjectMemberAccess, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_Comma:
		this->AddToken( TesToken( TTT_OpAssign, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpComma, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;

	case SCT_Minus:
		this->AddToken( TesToken( TTT_OpAssign, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpMinus, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_Dot:
		this->AddToken( TesToken( TTT_OpAssign, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		return SS_OneDotPassed;
	case SCT_Less:
		this->AddToken( TesToken( TTT_OpAssign, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		return SS_OneLessPassed;
	case SCT_Greater:
		this->AddToken( TesToken( TTT_OpAssign, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		return SS_OneGreaterPassed;
	case SCT_Unequal:
		this->AddToken( TesToken( TTT_OpAssign, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		return SS_OneUnequalPassed;

	case SCT_Equal:
		this->AddToken( TesToken( TTT_OpEqual, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		return SS_Normal;

	case SCT_Backslash:
	case SCT_Other:
	default:
		TesScannerError( mConfig, t("Invalid character detected."), this->GetCurrentCharLexLocation() );
	}

	return SS_InvalidState;
}


TesScanner::ScanState TesScanner::ProcessState_OneUnequalPassed( tchar ch )
{
	if( GetScanCharType( ch ) == SCT_Equal )
	{
		this->AddToken( TesToken( TTT_OpUnequal, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		return SS_Normal;
	}

	TesScannerError( mConfig, tstring( t("Expected '=', not ") ) + ch, this->GetCurrentCharLexLocation() );

	return SS_InvalidState;
}


TesScanner::ScanState TesScanner::ProcessState_OneLessPassed( tchar ch )
{
	ScanCharType type = GetScanCharType( ch );

	switch( type )
	{
	case SCT_Null:
	case SCT_TabOrSpace:
	case SCT_LineEnder:
		this->AddToken( TesToken( TTT_OpLessThan, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		return SS_Normal;
	case SCT_Semicolon:
		this->AddToken( TesToken( TTT_OpLessThan, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpSemicolon, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_AlphaOrUnderscore:
		this->AddToken( TesToken( TTT_OpLessThan, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		this->AppendCharToCurrentString( ch );
		return SS_InIdentifier;
	case SCT_Digit:
		this->AddToken( TesToken( TTT_OpLessThan, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		if( ch == t('0') )
		{
			return SS_OneZeroPassed;
		}
		else
		{
			this->AppendCharToCurrentString( ch );
			return SS_InDecimal;
		}

	case SCT_SingleQuote:
		this->AddToken( TesToken( TTT_OpLessThan, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		return SS_InSingleQuoteString;
	case SCT_DoubleQuote:
		this->AddToken( TesToken( TTT_OpLessThan, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		return SS_InDoubleQuoteString;

	case SCT_OpenParenthese:
		this->AddToken( TesToken( TTT_OpLessThan, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpenParenthese, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_CloseParenthese:
		this->AddToken( TesToken( TTT_OpLessThan, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_CloseParenthese, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_OpenBracket:
		this->AddToken( TesToken( TTT_OpLessThan, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpenBracket, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_CloseBracket:
		this->AddToken( TesToken( TTT_OpLessThan, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_CloseBracket, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_OpenBrace:
		this->AddToken( TesToken( TTT_OpLessThan, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpenBrace, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_CloseBrace:
		this->AddToken( TesToken( TTT_OpLessThan, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_CloseBrace, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;

	case SCT_Add:
		this->AddToken( TesToken( TTT_OpLessThan, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpAdd, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_Star:
		this->AddToken( TesToken( TTT_OpLessThan, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpMultiply, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_Slash:
		this->AddToken( TesToken( TTT_OpLessThan, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpDivide, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_Power:
		this->AddToken( TesToken( TTT_OpLessThan, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpPower, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_Percent:
		this->AddToken( TesToken( TTT_OpLessThan, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpMod, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_Sharp:
		this->AddToken( TesToken( TTT_OpLessThan, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		return SS_InLineComment;
	case SCT_Colon:
		this->AddToken( TesToken( TTT_OpLessThan, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpObjectMemberAccess, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_Comma:
		this->AddToken( TesToken( TTT_OpLessThan, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpComma, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;

	case SCT_Minus:
		this->AddToken( TesToken( TTT_OpLessThan, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpMinus, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_Dot:
		this->AddToken( TesToken( TTT_OpLessThan, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		return SS_OneDotPassed;
	case SCT_Less:
		this->AddToken( TesToken( TTT_OpLessThan, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		return SS_OneLessPassed;
	case SCT_Greater:
		this->AddToken( TesToken( TTT_OpLessThan, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		return SS_OneGreaterPassed;
	case SCT_Unequal:
		this->AddToken( TesToken( TTT_OpLessThan, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		return SS_OneUnequalPassed;

	case SCT_Equal:
		this->AddToken( TesToken( TTT_OpLessThanOrEqual, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		return SS_Normal;

	case SCT_Backslash:
	case SCT_Other:
	default:
		TesScannerError( mConfig, t("Invalid character detected."), this->GetCurrentCharLexLocation() );
	}

	return SS_InvalidState;
}


TesScanner::ScanState TesScanner::ProcessState_OneGreaterPassed( tchar ch )
{
	ScanCharType type = GetScanCharType( ch );

	switch( type )
	{
	case SCT_Null:
	case SCT_TabOrSpace:
	case SCT_LineEnder:
		this->AddToken( TesToken( TTT_OpGreaterThan, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		return SS_Normal;
	case SCT_Semicolon:
		this->AddToken( TesToken( TTT_OpGreaterThan, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpSemicolon, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_AlphaOrUnderscore:
		this->AddToken( TesToken( TTT_OpGreaterThan, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		this->AppendCharToCurrentString( ch );
		return SS_InIdentifier;
	case SCT_Digit:
		this->AddToken( TesToken( TTT_OpGreaterThan, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		if( ch == t('0') )
		{
			return SS_OneZeroPassed;
		}
		else
		{
			this->AppendCharToCurrentString( ch );
			return SS_InDecimal;
		}

	case SCT_SingleQuote:
		this->AddToken( TesToken( TTT_OpGreaterThan, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		return SS_InSingleQuoteString;
	case SCT_DoubleQuote:
		this->AddToken( TesToken( TTT_OpGreaterThan, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		return SS_InDoubleQuoteString;

	case SCT_OpenParenthese:
		this->AddToken( TesToken( TTT_OpGreaterThan, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpenParenthese, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_CloseParenthese:
		this->AddToken( TesToken( TTT_OpGreaterThan, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_CloseParenthese, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_OpenBracket:
		this->AddToken( TesToken( TTT_OpGreaterThan, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpenBracket, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_CloseBracket:
		this->AddToken( TesToken( TTT_OpGreaterThan, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_CloseBracket, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_OpenBrace:
		this->AddToken( TesToken( TTT_OpGreaterThan, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpenBrace, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_CloseBrace:
		this->AddToken( TesToken( TTT_OpGreaterThan, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_CloseBrace, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;

	case SCT_Add:
		this->AddToken( TesToken( TTT_OpGreaterThan, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpAdd, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_Star:
		this->AddToken( TesToken( TTT_OpGreaterThan, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpMultiply, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_Slash:
		this->AddToken( TesToken( TTT_OpGreaterThan, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpDivide, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_Power:
		this->AddToken( TesToken( TTT_OpGreaterThan, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpPower, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_Percent:
		this->AddToken( TesToken( TTT_OpGreaterThan, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpMod, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_Sharp:
		this->AddToken( TesToken( TTT_OpGreaterThan, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		return SS_InLineComment;
	case SCT_Colon:
		this->AddToken( TesToken( TTT_OpGreaterThan, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpObjectMemberAccess, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_Comma:
		this->AddToken( TesToken( TTT_OpGreaterThan, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpComma, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;

	case SCT_Minus:
		this->AddToken( TesToken( TTT_OpGreaterThan, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpMinus, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_Dot:
		this->AddToken( TesToken( TTT_OpGreaterThan, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		return SS_OneDotPassed;
	case SCT_Less:
		this->AddToken( TesToken( TTT_OpGreaterThan, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		return SS_OneLessPassed;
	case SCT_Greater:
		this->AddToken( TesToken( TTT_OpGreaterThan, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		return SS_OneGreaterPassed;
	case SCT_Unequal:
		this->AddToken( TesToken( TTT_OpGreaterThan, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		return SS_OneUnequalPassed;

	case SCT_Equal:
		this->AddToken( TesToken( TTT_OpGreaterThanOrEqual, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		return SS_Normal;

	case SCT_Backslash:
	case SCT_Other:
	default:
		TesScannerError( mConfig, t("Invalid character detected."), this->GetCurrentCharLexLocation() );
	}

	return SS_InvalidState;
}


TesScanner::ScanState TesScanner::ProcessState_OneDotPassed( tchar ch )
{
	ScanCharType type = GetScanCharType( ch );

	switch( type )
	{
	case SCT_Null:
	case SCT_TabOrSpace:
	case SCT_LineEnder:
		this->AddToken( TesToken( TTT_OpTableMemberAccess, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		return SS_Normal;
	case SCT_Semicolon:
		this->AddToken( TesToken( TTT_OpTableMemberAccess, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpSemicolon, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_AlphaOrUnderscore:
		this->AddToken( TesToken( TTT_OpTableMemberAccess, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		this->AppendCharToCurrentString( ch );
		return SS_InIdentifier;
	case SCT_Digit:
		this->AddToken( TesToken( TTT_OpTableMemberAccess, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		if( ch == t('0') )
		{
			return SS_OneZeroPassed;
		}
		else
		{
			this->AppendCharToCurrentString( ch );
			return SS_InDecimal;
		}

	case SCT_SingleQuote:
		this->AddToken( TesToken( TTT_OpTableMemberAccess, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		return SS_InSingleQuoteString;
	case SCT_DoubleQuote:
		this->AddToken( TesToken( TTT_OpTableMemberAccess, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		return SS_InDoubleQuoteString;

	case SCT_OpenParenthese:
		this->AddToken( TesToken( TTT_OpTableMemberAccess, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpenParenthese, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_CloseParenthese:
		this->AddToken( TesToken( TTT_OpTableMemberAccess, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_CloseParenthese, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_OpenBracket:
		this->AddToken( TesToken( TTT_OpTableMemberAccess, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpenBracket, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_CloseBracket:
		this->AddToken( TesToken( TTT_OpTableMemberAccess, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_CloseBracket, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_OpenBrace:
		this->AddToken( TesToken( TTT_OpTableMemberAccess, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpenBrace, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_CloseBrace:
		this->AddToken( TesToken( TTT_OpTableMemberAccess, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_CloseBrace, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;

	case SCT_Add:
		this->AddToken( TesToken( TTT_OpTableMemberAccess, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpAdd, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_Star:
		this->AddToken( TesToken( TTT_OpTableMemberAccess, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpMultiply, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_Slash:
		this->AddToken( TesToken( TTT_OpTableMemberAccess, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpDivide, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_Power:
		this->AddToken( TesToken( TTT_OpTableMemberAccess, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpPower, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_Percent:
		this->AddToken( TesToken( TTT_OpTableMemberAccess, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpMod, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_Sharp:
		this->AddToken( TesToken( TTT_OpTableMemberAccess, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		return SS_InLineComment;
	case SCT_Colon:
		this->AddToken( TesToken( TTT_OpTableMemberAccess, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpObjectMemberAccess, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_Comma:
		this->AddToken( TesToken( TTT_OpTableMemberAccess, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpComma, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;

	case SCT_Less:
		this->AddToken( TesToken( TTT_OpTableMemberAccess, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		return SS_OneLessPassed;
	case SCT_Greater:
		this->AddToken( TesToken( TTT_OpTableMemberAccess, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		return SS_OneGreaterPassed;
	case SCT_Unequal:
		this->AddToken( TesToken( TTT_OpTableMemberAccess, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		return SS_OneUnequalPassed;
	case SCT_Equal:
		this->AddToken( TesToken( TTT_OpTableMemberAccess, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		return SS_OneEqualPassed;
	case SCT_Minus:
		this->AddToken( TesToken( TTT_OpTableMemberAccess, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		return SS_InLineComment;

	case SCT_Dot:
		this->AppendCharToCurrentString( ch );
		return SS_TwoDotPassed;

	case SCT_Backslash:
	case SCT_Other:
	default:
		TesScannerError( mConfig, t("Invalid character detected."), this->GetCurrentCharLexLocation() );
	}

	return SS_InvalidState;
}


TesScanner::ScanState TesScanner::ProcessState_TwoDotPassed( tchar ch )
{
	ScanCharType type = GetScanCharType( ch );

	switch( type )
	{
	case SCT_Null:
	case SCT_TabOrSpace:
	case SCT_LineEnder:
		this->AddToken( TesToken( TTT_OpStringConcatenate, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		return SS_Normal;
	case SCT_Semicolon:
		this->AddToken( TesToken( TTT_OpStringConcatenate, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpSemicolon, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_AlphaOrUnderscore:
		this->AddToken( TesToken( TTT_OpStringConcatenate, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		this->AppendCharToCurrentString( ch );
		return SS_InIdentifier;
	case SCT_Digit:
		this->AddToken( TesToken( TTT_OpStringConcatenate, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		if( ch == t('0') )
		{
			return SS_OneZeroPassed;
		}
		else
		{
			this->AppendCharToCurrentString( ch );
			return SS_InDecimal;
		}

	case SCT_SingleQuote:
		this->AddToken( TesToken( TTT_OpStringConcatenate, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		return SS_InSingleQuoteString;
	case SCT_DoubleQuote:
		this->AddToken( TesToken( TTT_OpStringConcatenate, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		return SS_InDoubleQuoteString;

	case SCT_OpenParenthese:
		this->AddToken( TesToken( TTT_OpStringConcatenate, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpenParenthese, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_CloseParenthese:
		this->AddToken( TesToken( TTT_OpStringConcatenate, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_CloseParenthese, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_OpenBracket:
		this->AddToken( TesToken( TTT_OpStringConcatenate, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpenBracket, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_CloseBracket:
		this->AddToken( TesToken( TTT_OpStringConcatenate, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_CloseBracket, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_OpenBrace:
		this->AddToken( TesToken( TTT_OpStringConcatenate, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpenBrace, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_CloseBrace:
		this->AddToken( TesToken( TTT_OpStringConcatenate, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_CloseBrace, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;

	case SCT_Add:
		this->AddToken( TesToken( TTT_OpStringConcatenate, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpAdd, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_Star:
		this->AddToken( TesToken( TTT_OpStringConcatenate, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpMultiply, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_Slash:
		this->AddToken( TesToken( TTT_OpStringConcatenate, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpDivide, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_Power:
		this->AddToken( TesToken( TTT_OpStringConcatenate, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpPower, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_Percent:
		this->AddToken( TesToken( TTT_OpStringConcatenate, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpMod, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_Sharp:
		this->AddToken( TesToken( TTT_OpStringConcatenate, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		return SS_InLineComment;
	case SCT_Colon:
		this->AddToken( TesToken( TTT_OpStringConcatenate, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpObjectMemberAccess, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;
	case SCT_Comma:
		this->AddToken( TesToken( TTT_OpStringConcatenate, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		this->AddToken( TesToken( TTT_OpComma, this->GetCurrentCharLexLocation() ) );
		return SS_Normal;

	case SCT_Less:
		this->AddToken( TesToken( TTT_OpStringConcatenate, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		return SS_OneLessPassed;
	case SCT_Greater:
		this->AddToken( TesToken( TTT_OpStringConcatenate, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		return SS_OneGreaterPassed;
	case SCT_Unequal:
		this->AddToken( TesToken( TTT_OpStringConcatenate, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		return SS_OneUnequalPassed;
	case SCT_Equal:
		this->AddToken( TesToken( TTT_OpStringConcatenate, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		return SS_OneEqualPassed;
	case SCT_Minus:
		this->AddToken( TesToken( TTT_OpStringConcatenate, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		return SS_InLineComment;

	case SCT_Dot:
		this->AddToken( TesToken( TTT_OpVariousParameters, this->GetStringBeginLexLocation() ) );
		this->ClearCurrentString();
		return SS_Normal;

	case SCT_Backslash:
	case SCT_Other:
	default:
		TesScannerError( mConfig, t("Invalid character detected."), this->GetCurrentCharLexLocation() );
	}

	return SS_InvalidState;
}